﻿@model IEnumerable<ShenLanCMS.Models.PostType>
@{
    ViewBag.Title = "分类管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<fieldset>
    <legend>分类管理 | @Html.ActionLink("添加", "add")</legend>
    <br />
    <table>
        <tr>
            <th>
                名称
            </th>
            <th>
                关键词
            </th>
            <th>
                描述
            </th>
            @*<th>
                父级
            </th>
            <th>
                层
            </th>
            <th>
                是否终极分类
            </th>*@
            <th>
                操作
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.TypeName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Keyword)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Description)
                </td>
                @*<td>
                    @Html.DisplayFor(modelItem => item.ParentID)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Layer)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.IsLast)
                </td>*@
                <td>
                    @Html.ActionLink("编辑", "Edit", new { id = item.PostTypeID })
                    | <a href="javascript:delType('@item.PostTypeID')">删除</a>
                </td>
            </tr>
        }
    </table>
</fieldset>
<script type="text/javascript">
    function delType(obj) {
        if (confirm("确定要删除该分类吗?")) {
            $.post("/posttype/delete/" + obj, function (data) {
                alert(data);
                if (data == "删除成功")
                    window.location.reload();
            });
        }
    }
</script>
